package mobi.daogu.powerstripcontroller.widget

import android.content.Context
import android.util.AttributeSet
import android.widget.TextView

/**
 * @FileName: ConfigItemView.kt
 * @Description:
 * @Author: Gene
 * @Email: gene.fang@ringcentral.com
 * @Date: 2024/11/19 17:33
 */
class ConfigItemView@JvmOverloads constructor(
    context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : TextView(context, attrs, defStyleAttr) {
    private val drawable = PowerStripStatusDrawable(resources)

    init {
        background = drawable
    }

    fun updateConfig(isActive: Boolean, interruptStatus: PowerStripStatusDrawable.Companion.InterruptStatus, turnOnTriggers: List<Int>, turnOffTriggers: List<Int>) {
        drawable.updateStatus(isActive, interruptStatus, turnOnTriggers, turnOffTriggers)
    }
}